package com.project.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.project.bean.CustomerBean;
import com.project.bean.JournalBean;
import com.project.mapper.IJournalMapper;
import com.project.service.IJournalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.time.LocalDate;

@Service
@Transactional
public class JournalServiceImpl implements IJournalService {
    @Autowired
    private IJournalMapper mapper;
    @Override
    public Page<JournalBean> findByItem(Integer pageNo, LocalDate startDate, LocalDate endDate) {
        QueryWrapper<JournalBean> qw = new QueryWrapper<>();
        if (startDate!=null){
            qw.ge("j_date",startDate);
        }
        if (endDate!=null){
            qw.like("j_date",endDate);
        }
        return mapper.selectPage(new Page(pageNo,5),qw) ;
    }
}
